package com.thread.plbc;

/**
 * @author げっしょく
 * @date 2021/8/5
 */
public class ThreadDemo3 {
    public static void main(String[] args) {
        //怎么正常终止线程
        ThreadD3exer d = new ThreadD3exer();
        Thread t3 = new Thread(d);
        t3.setName("tt");
        t3.start();
        try {
            Thread.sleep(1000 * 5);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        //stop强行停止，但是可能会丢失数据
        //t3.stop();
        d.run = false;
        System.out.println("main线程打印方法");
        System.out.println("main线程打印方法");
        System.out.println("main线程打印方法");
        System.out.println("main线程打印方法");
        System.out.println("main线程打印方法");
        System.out.println("main线程打印方法");
        System.out.println("main线程打印方法");
        System.out.println("main线程打印方法");
        System.out.println("main线程打印方法");
    }
}
